package com.ilearn.springbean;

/**
 * @author: lyndon
 * @version: 1.0
 * @date: 2019/1/27
 */

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;

/**
 * @author 五月的仓颉 http://www.cnblogs.com/xrq730/p/5721366.html
 */
@Component(value = "lifeCycleBean")
public class LifeCycleBean implements InitializingBean, DisposableBean
{
    @SuppressWarnings("unused")
    private String lifeCycleBeanName;

    public void setLifeCycleBeanName(String lifeCycleBeanName)
    {
        System.out.println("Enter LifecycleBean.setLifeCycleBeanName(), lifeCycleBeanName = " + lifeCycleBeanName);
        this.lifeCycleBeanName = lifeCycleBeanName;
    }

    @Override
    public void destroy() throws Exception
    {
        System.out.println("Enter LifecycleBean.destroy()");
    }

    @Override
    public void afterPropertiesSet() throws Exception
    {
        System.out.println("Enter LifecycleBean.afterPropertiesSet()");
    }

    public void beanStart()
    {
        System.out.println("Enter LifecycleBean.beanStart()");
    }

    public void beanEnd()
    {
        System.out.println("Enter LifecycleBean.beanEnd()");
    }
}